package com.yh.controller;

import com.yh.entity.OrderInfo;
import com.yh.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/createOrder")
    public void createOrder(){
        orderService.createOrder();
    }

    @GetMapping("/getOrder")
    public OrderInfo getOrder(Long orderId){
        OrderInfo orderInfo = orderService.getOrder(orderId);
        return orderInfo;
    }
}
